<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="jQuery/jquery-2.1.1.min.js"></script>
<script src="jQuery/jquery-ui.min.js"></script>
<script type="text/javascript">
	$(function() {
		$("#button1")
				.click(
						function() {
							$
									.ajax({
										type : "POST",
										url : "Ajax-json",
										dateType : "json",
										data : {
											'log.id' : $("#param1").val(),
											'log.msg' : $("#param2").val()
										},
										success : function(json) {
											var html = "<table width='60%' border='1' align='center'>"
													+ "<tr><th>id</th><th>msg</th></tr>";
// 											for (var i = 0; i <= json.length; i++) {
												var log = json;
												var id = log.id;
												var msg = log.msg;
												html += "<tr align='center'><td>" + id
														+ "</td><td>" + msg
														+ "</td></tr>";
// 											}

											html += "</table>";
											$("#theBody table:eq(0)").remove();
											$("#theBody").append(html);
										},
										error : function() {
											alert('数据加载失败,请重试..');
											//window.close(); 
										}
									});

						});
	});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body id="theBody">
	<input type="text" id="param1">
	<input type="text" id="param2">
	<input type="text" id="result">
	<input type="button" value="get content from server" id="button1">


</body>
</html>